﻿using DPS.Prototype.Provider;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using DPS.Prototype.Model;
using System.Collections.Generic;

namespace DPSTesting
{
    
    
    /// <summary>
    ///This is a test class for ProductLineProviderDataControllerTest and is intended
    ///to contain all ProductLineProviderDataControllerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ProductLineProviderDataControllerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for AdaptCapacityList
        ///</summary>
        [TestMethod()]
        [DeploymentItem("DPS.Prototype.dll")]
        public void AdaptCapacityListTest()
        {
            ProductLineProvider_Accessor target = new ProductLineProvider_Accessor(); // TODO: Initialize to an appropriate value
            List<Capacity> listCapacity = new List<Capacity>();
            int count = 10;
            for (int index = 0; index < count; index++)
            {
                Capacity c = new Capacity();
                c.SortNo = index;
                listCapacity.Add(c);
            }
            List<Capacity> actual;
            actual = target.AdaptCapacityList(listCapacity);
            Assert.AreEqual(0, actual[0].SortNo);
            Assert.AreEqual(null, actual[0].Previous);
            Assert.AreEqual(listCapacity[1], actual[0].Next);
            Assert.AreEqual(listCapacity[2], actual[1].Next);
            Assert.AreEqual(listCapacity[9], actual[8].Next);
            Assert.AreEqual(listCapacity[8], actual[9].Previous);
        }

        /// <summary>
        ///A test for GetAllProductLine
        ///</summary>
        [TestMethod()]
        public void GetAllProductLineTest()
        {
            ProductLineProvider target = new ProductLineProvider(); // TODO: Initialize to an appropriate value
            List<ProdLine> actual;
            actual = target.GetAllProductLine();
            Assert.AreEqual(4, actual.Count);
            Assert.AreEqual(49, actual[0].Capacitys.Count);
        }
    }
}
